package br.com.fafica.sisape.repositorioarray;

import java.util.ArrayList;

import br.com.fafica.sisape.model.AgendaExame;;

public class RepositorioAgendaExame {
	
	static ArrayList <AgendaExame> agenda = new ArrayList<AgendaExame>();
	static Integer cod = 0;
	
	public void createAgendaExame(AgendaExame agendaExame){
		cod ++;
		agendaExame.setCod(cod);
		agenda.add(agendaExame);
	}
	public ArrayList readAgendaExame(){
		
		return agenda;
	}
	public void updateAgendaExame(AgendaExame agendaExame){
		
		for(int i = 0; i < agenda.size(); i++){
			if(agenda.get(i).getCod() == agendaExame.getCod()){
				agenda.set(i, agendaExame);
			}
		}
	}
	public void deleteAgendaExame(AgendaExame agendaExame){
		
		for(int i = 0; i < agenda.size(); i++){
			if(agenda.get(i).getCod() == agendaExame.getCod()){
				agenda.remove(i);
			}
		}
		
	}

}
